package com.example.demo.util;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.AndroidUser;
import com.example.demo.mapper.AndroidUserMapper;
import org.springframework.beans.factory.annotation.Autowired;

public class getUserId {

    @Autowired
    private static BaseMapper<AndroidUser> androidUserMapper;

//    private AndroidUserMapper androidUserMapper;

    public static Integer getUserId(String userName){
        QueryWrapper<AndroidUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_name",userName);
        AndroidUser androidUser = androidUserMapper.selectOne(queryWrapper);
        return androidUser.getId();

    }

}
